<%--
  Created by IntelliJ IDEA.
  User: kuankuan
  Date: 2023/3/9
  Time: 10:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <link rel="stylesheet" href="/css/bootstrap-theme.min.css">
    <script src="/js/jquery-1.12.4.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
    <style>
        body {
            background: none repeat scroll 0 0 #D8EDFC;
            margin: 0;
            padding: 0;
        }
    </style>

</head>
<body>

<table width="600" align="center"  class="table">
    <caption>订单</caption>
    <thead>
    <th>order_id</th>
    <th>table_id</th>
    <th>user_id</th>
    <th>total_num</th>
    <th>order_total_price</th>
    <th>order_status</th>
    <th width="200">操作</th>
    </thead>
    <tbody>
    <c:forEach var="item" items="${requestScope.pageBean1.datas}">
        <tr>

            <td>${item.order_id}</td>
            <td>${item.table_id}</td>
            <td>${item.user_id}</td>
            <td>${item.total_num}</td>
            <td>${item.order_total_price}</td>
            <td>${item.order_status}</td>
            <td>
                <a class="cnt" onclick="jiezhang(${item.order_total_price},${item.user_id},${item.order_id},${item.table_id})">结账</a>
            </td>
        </tr>
    </c:forEach>
    </tbody>
</table>

</body>

<script>
    function jiezhang(price,user_id,order_id,table_id) {
        fetch("/users?action=jiezhang&order_total_price="+price+"&user_id="+user_id+"&order_id="+order_id+"&table_id="+table_id).then(data=>{
            location.reload()
        })
    }

</script>

</html>
